// 剩余参数
function createElement(tagName, props, ...children) {
    console.log(tagName, props, children)
    if(!tagName) {
        throw new Error('参数不合法')
    }
    var realDom = document.createElement(tagName)
    if(props){
        Object.keys(props).forEach(key => {
            realDom.setAttribute(key, props[key])
        })
    }
    if(children) {
        children.forEach(item => {
            if(typeof item === 'string') {
                realDom.innerHTML = item
            } else {
                realDom.appendChild(item)
                console.log('children', item)
            }
        })
    }
    return realDom
}

const myStyle = {
    fontSize: 100
}
const arr = ['reat', 'name']
var vDom = <div className="user" id="app" class="user">
    {
        arr.map(item => <span>{ item }</span>)
        // 返回值
        // [
        //     <span>reat</span>,
        //     <span>name</span>
        // ]
    }
</div>
document.body.appendChild(vDom)